package com.ytjj.qmyx.mall.utils;

import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author EDY
 */
public class ArrayUtil {

    /**
     * 给数组添加元素
     */
    public static String[] add(String[] oldArray,String elements) {
        if (StringUtils.isNotEmpty(elements)) {
            String[] element = elements.split(",");
            List<String> list = new ArrayList<>(Arrays.asList(oldArray));
            list.addAll(Arrays.asList(element));
            return list.toArray(oldArray);
        }
       return oldArray;
    }

}
